package com.xinqi.modules.sys.dict.controller.inner;

import com.xinqi.common.base.response.PageInfo;
import com.xinqi.common.base.response.Param;
import com.xinqi.common.base.response.R;
import com.xinqi.modules.sys.dict.dto.req.DictVersionQueryDTO;
import com.xinqi.modules.sys.dict.dto.rsp.DictVersionResultDTO;
import com.xinqi.modules.sys.dict.service.DictVersionService;
import io.swagger.v3.oas.annotations.Hidden;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 字典-版本内部控制层
 *
 * @author: linkai
 * @date: 2023/05/07
 */
@Hidden
@RestController
@RequestMapping("/inner/dict-version")
@RequiredArgsConstructor
public class DictVersionInnerController {
    private final DictVersionService dictVersionService;

    /**
     * 字典-版本-分页
     */
    @GetMapping("/page")
    public R<PageInfo<DictVersionResultDTO>> page(Param pageable, DictVersionQueryDTO dto) {
        PageInfo<DictVersionResultDTO> page = dictVersionService.page(pageable, dto);
        return R.data(page);
    }

    /**
     * 字典-版本-详情
     */
    @GetMapping("/{id}")
    public R<DictVersionResultDTO> findById(@PathVariable("id") Long id) {
        DictVersionResultDTO dto = dictVersionService.findById(id);
        return R.data(dto);
    }
}
